{extend name="base" /}
{block name="title"}账号登陆{/block}
{block name="head"}{/block}
{block name="body"}
<div class="page-hd"></div>
<div class="page-bd">
<form>
  <div class="weui_cells weui_cells_form" style="margin-top:0">
    <div class="weui_cell">
      <div class="weui_cell_hd"><label class="weui_label">手机号码</label></div>
      <div class="weui_cell_bd weui_cell_primary">
        <input class="weui_input" type="tel" autocomplete="off" required pattern="[0-9]{11}" maxlength="11" placeholder="请输入手机号码" emptyTips="请输入手机号" notMatchTips="请输入正确的手机号" name="sjhm" value="{$Agent.MobilePhone|default=''|htmlentities}" />
      </div>
      <div class="weui_cell_ft"><i class="weui_icon_warn"></i></div>
    </div>
    <div class="weui_cell">
      <div class="weui_cell_hd"><label for="" class="weui_label">安全密码</label></div>
      <div class="weui_cell_bd weui_cell_primary">
        <input class="weui_input" type="password" required pattern="[\S]{1,16}" placeholder="请输入安全密码" notMatchTips="安全密码不正确" name="aqmm" value="{$Agent.LogonPass|default=''|htmlentities}" />
      </div>
      <div class="weui_cell_ft"><i class="weui_icon_warn"></i>
      </div>

    </div>
    <div class="weui_btn_area">
      <div class="verify-wrap weui_btn" id="verify-wrap"></div>
    </div>
  <div class="weui_btn_area">

    <a class="weui_btn" id="subbtn" style="background: #9e9e9e">提交</a>
    <a class="weui_btn weui_btn_primary" href="{:url('register')}">没有账号, 点击这里申请</a>
  </div>
</form>
</div>
{/block}
{block name="foot"}

<script>
  $(function() {
    var SlideVerifyPlug = window.slideVerifyPlug;
    var slideVerify = new SlideVerifyPlug('#verify-wrap', {
      wrapWidth: '100%',//设置 容器的宽度 ,不设置的话，会设置成100%，需要自己在外层包层div,设置宽度，这是为了适应方便点；
      initText: '请按住滑块验证',  //设置  初始的 显示文字
      sucessText: '验证通过',//设置 验证通过 显示的文字
      getSuccessState: function (res) {
        //当验证完成的时候 会 返回 res 值 true，只留了这个应该够用了
        if (slideVerify.slideFinishState == true){
          $("#subbtn").attr("class","weui_btn weui_btn_primary").removeAttr("style","");
          var $form = $("form").form();
          $('#subbtn').on('click', function () {
            $form.validate(function (err) {
              if (!err) {
              var data = $form.serialize();
              $.req({
                type: 'POST',
                url: "{:url('login')}",
                data: data,
                success(resp, text, xhr) {
                  $.alert(resp.error, function () {
                  if (resp.erron == 0) {
                      location.reload();
                    }else{
                      location.reload();
                    }
                    });
                  }
                });
              }
            });
          });
        }else{
          $.alert("请通过滑块验证哦~");
        }
      },
    });
  })
</script>
{/block}